<?php

namespace App\Http\Controllers\Wxapi\newWork;

use Illuminate\Support\Facades\DB;

class WxMessageController extends CommonController
{
    public function __construct(){
        parent::__construct([]);
    }

    public function getTemplateId(){
        if ($this->result['status'] > 0){
            return $this->return_result($this->result);
        }
        $param = request()->post();
        if(empty($param["key"])){
            $this->result['status'] = 1;
            $this->result['msg'] = 'key参数不能为空';
            return $this->return_result($this->result);
        }
        $templateId = '';
        $setting = DB::table("new_work_setting")->select("wx_reply_template", "sms_reply_template")->where("mall_id", request()->mallData["id"])->first();
        switch ($param["key"]){
            case "NewWorkFeedbackReply": $templateId = $setting->wx_reply_template; break;
        }
        $this->result['data'] = ["templateId" => [$templateId]];
        return $this->return_result($this->result);
    }
}
